﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using BOHVote.Common;
 
using BOHVote.BLL;
using BOHVote.Entity;

namespace BOH.Information
{
    public partial class Information : System.Web.UI.Page
    {
        public BHUser user = new BHUser();
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Title = common.getAppSetting("AppName");
            ((HiddenField)this.Master.FindControl("hiddenPageName")).Value = "IS";
            if (Session["User"] != null)
            {
                user = (BHUser)Session["User"];
                SetVisible(user.RightType);
            }
        }

        protected void SetVisible(string UserType)
        {
            switch (UserType)
            { 
                //case"U":
                case"P":
                    liReport.Visible = false;
                    liApplyList.Visible = false;
                    linkApplyAdd.Visible = true;
                    linkPPTApplyList.Visible = SysConfigClass.IsAllowUploadPPT();
                    liReport.Visible = false;
                    liPersonalReport.Visible = false;
                    liApplyListReport.Visible = false;
                    break;
                case "G":
                    linkApplyList.HRef = "ApplyList.aspx";
                    liReport.Visible = true;
                    liApplyList.Visible = true;
                    linkApplyAdd.Visible = user.CanApplyGrovenUnit;
                    linkPPTApplyList.Visible = SysConfigClass.IsAllowUploadPPT() && user.CanApplyGrovenUnit ? true : false;
                    linkApplyList.Visible = SysConfigClass.IsAllowModifyApplyer();
                    liPersonalReport.Visible = true;
                    liApplyListReport.Visible = true;
                    break;
                case "U":
                    linkApplyList.HRef = "ApplyList.aspx";
                    liReport.Visible = true;
                    liApplyList.Visible = true;
                    linkApplyAdd.Visible = user.CanApplyGrovenUnit;
                    linkPPTApplyList.Visible = SysConfigClass.IsAllowUploadPPT() && user.CanApplyGrovenUnit ? true: false;
                    linkApplyList.Visible = SysConfigClass.IsAllowModifyApplyer();
                    liPersonalReport.Visible = true;
                    liApplyListReport.Visible = false;
                    break;
                case "A":
                case "C":
                    linkApplyList.HRef = "ApplyList.aspx";
                    liReport.Visible = true;
                    liApplyList.Visible = true;
                    linkApplyAdd.Visible = true;
                    linkPPTApplyList.Visible = SysConfigClass.IsAllowUploadPPT() && user.CanApplyGrovenUnit ? true : false;
                    linkApplyList.Visible = SysConfigClass.IsAllowModifyApplyer();
                    liPersonalReport.Visible = true;
                    liApplyListReport.Visible = true;
                    break;
                default:
                    linkApplyList.HRef = "ApplyList.aspx";
                    liReport.Visible = false;
                    liApplyList.Visible = false;
                    linkPPTApplyList.Visible = false;
                    linkApplyAdd.Visible = false;
                    liPersonalReport.Visible = false;
                    liApplyListReport.Visible = false;
                    break;
            }
        }
    }
}
